<div class="page">
	<div class="page-header">
		<div class="pull-left">
			<i class="icon-awesome-user icon-large"></i>
			<span class="divider"></span>
			<div class="title">
				<h3><?php echo __('Usuários'); ?></h3>
				<small><?php echo ('Gerencie todos os usuários do sistema'); ?></small>
			</div>
		</div>
		<div class="pull-right">
			<?php echo $this->Html->link('<i class="icon-awesome-plus icon-white"></i>'.__('Novo'), array('action' => 'add'), array('escape' => false, 'class' => 'btn btn-primary btn-square', 'title' => 'Cadastrar Novo Usuário')); ?>
		</div>
	</div>
	<div class="page-content">
		<?php echo $this->Form->create('Filter', array('class' => 'well')); ?>
		<div class="control-group">
			<div class="controls">
				<div class="input-append">
					<?php echo $this->Form->input('Filter.palavra_chave', array('label' => false, 'div' => false, 'class' => 'span12','placeholder' => 'Digite a palavra-chave')); ?>
					<?php echo $this->Form->button('<i class="icon-search icon-white"></i> Pesquisar', array('type' => 'submit', 'div' => false, 'class' => 'btn btn-primary', 'escape' => false)); ?>
				</div>
			</div>
		</div>
		<?php echo $this->Form->end();?>
		
		<table class="table table-bordered table-striped table-condensed">
		<thead>
		<tr>
			<th><?php echo $this->Paginator->sort('id');?></th>
			<th><?php echo $this->Paginator->sort('login', 'Usuário');?></th>
			<th><?php echo $this->Paginator->sort('perfil_id');?></th>
			<th><?php echo $this->Paginator->sort('nome');?></th>
			<th><?php echo $this->Paginator->sort('email', 'E-mail');?></th>
			<th><?php echo $this->Paginator->sort('situacao', 'Situação');?></th>
			<th class="actions"><?php echo __('Ações');?></th>
		</tr>
		</thead>
		<tbody>
<?php
		foreach ($usuarios as $usuario): ?>
		<tr>
			<td><?php echo h($usuario['Usuario']['id']); ?>&nbsp;</td>
			<td><?php echo h($usuario['Usuario']['login']); ?>&nbsp;</td>
			<td>
			<?php echo h($usuario['Perfil']['nome']); ?>
		</td>
			<td><?php echo h($usuario['Usuario']['nome']); ?>&nbsp;</td>
			<td><?php echo h($usuario['Usuario']['email']); ?>&nbsp;</td>
			<td><?php
				if ($usuario['Usuario']['situacao'] == 'A') { ?>
				<span class="label label-success"><?php echo h($situacaos[$usuario['Usuario']['situacao']]); ?></span>
				<?php } else { ?> 
				<span class="label"><?php echo h($situacaos[$usuario['Usuario']['situacao']]); ?></span>
				<?php } ?>
			</td>
			<td class="actions">
			<?php echo $this->Form->postLink('<i class="icon-share icon-white"></i>', array('action' => 'sendpass', $usuario['Usuario']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini'), __('Reenviar Senha para %s?', $usuario['Usuario']['email'])); ?>			
				<?php echo $this->Html->link('<i class="icon-eye-open icon-white"></i>', array('action' => 'view', $usuario['Usuario']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini')); ?>
				<?php echo $this->Html->link('<i class="icon-edit icon-white"></i>', array('action' => 'edit', $usuario['Usuario']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini')); ?>
				<?php echo $this->Form->postLink('<i class="icon-trash icon-white"></i>', array('action' => 'delete', $usuario['Usuario']['id']), array('escape' => false, 'class' => 'btn btn-danger btn-mini'), __('Deseja Realmente deletar # %s?', $usuario['Usuario']['id'])); ?>
			</td>
		</tr>
<?php endforeach; ?>
		</tbody>
		</table>
		<?php echo $this->element('pagination'); ?>	
	</div>
</div>
<?php echo $this->element('form-modal'); ?>
<?php echo $this->Html->script('form-modal'); ?>